//   @Author: zeng_ze
//   @date: 2020-3-10
//   @Description: 多租户配置接口
import request from '@/utils/request'

//获得所有租户分页
export function getTenant(data) {
  return request({
    url: '/sys-system/tenant/page',
    method: 'get',
    params: data
  })
}
//获得所有租户
export function getAllTenants() {
  return request({
    url: '/sys-system/tenants',
    method: 'get',
    params: {

    }
  })
}
//删除租户 根据id
export function deleteTenant(id) {
  return request({
    url: '/sys-system/tenant',
    method: 'delete',
    params: {
      id
    }
  })
}
//编辑租户
export function editTenant(data) {
  return request({
    url: '/sys-system/tenant',
    method: 'put',
    data: data,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

//新增租户
export function addTenant(data) {
  return request({
    url: '/sys-system/tenant',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}
//获取应用分页
export function getClients(data) {
  return request({
    url: '/sys-system/clients/page',
    method: 'get',
    params: data
  })
}

/** 新建租户下应用 */
export function addClient(data) {
  return request({
    url: '/sys-system/client',
    method: 'post',
    data: data,
    text: true,
    headers: {/*  */
      'Content-Type': 'application/json;charset=UTF-8'
    },
  })
}

/** 更新角色 */
export function saveClient(data) {
  return request({
    url: '/sys-system/client',
    method: 'PUT',
    data: data,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}
/** 删除应用 */
export function deleteClient(id) {
  return request({
    url: '/sys-system/client',
    method: 'DELETE',
    params: {
      id
    }
  })
}

//获取租户配置的组织机构
export function getOrg(tenantId) {
  return request({
    url: '/sys-system/tenant/org',
    method: 'get',
    params: {
      tenantId: tenantId

    }
  })
}
//更新租户配置的组织机构
export function editOrg(data) {
  return request({
    url: '/sys-system/tenant/org',
    method: 'put',
    data: data,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}